//
//  LSZSignInformationManager.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/6/7.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZSignInformationManager.h"

@implementation LSZSignInformationManager
-(id)initWithSignInformation :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSMutableArray * AddArrayMg = [[NSMutableArray alloc]init];
        LSZSignInformationMg * mg = [[LSZSignInformationMg alloc]init];
        mg.sign = NullStringjudgment(NSStr(dic[@"data"][@"sign"]));
        mg.is_sign = NullStringjudgment(NSStr(dic[@"data"][@"is_sign"]));
        mg.avatar = NullStringjudgment(NSStr(dic[@"data"][@"avatar"]));
        mg.signin_days = NullStringjudgment(NSStr(dic[@"data"][@"signin_days"]));
        mg.credit = NullStringjudgment(NSStr(dic[@"data"][@"credit"]));
        mg.signin_total = NullStringjudgment(NSStr(dic[@"data"][@"signin_total"]));
        mg.ranking = NullStringjudgment(NSStr(dic[@"data"][@"ranking"]));
        mg.username = NullStringjudgment(NSStr(dic[@"data"][@"username"]));

        mg.sign_m = NullStringjudgment(NSStr(dic[@"data"][@"sign_m"]));
        mg.is_sign_m = NullStringjudgment(NSStr(dic[@"data"][@"is_sign_m"]));
        mg.sign_n = NullStringjudgment(NSStr(dic[@"data"][@"sign_n"]));
        mg.is_sign_n = NullStringjudgment(NSStr(dic[@"data"][@"is_sign_n"]));

        NSArray * arrayConfig = dic[@"data"][@"sign_config"];
        mg.arrayValue = arrayConfig;

        NSMutableArray * mutAdvArray = [[NSMutableArray alloc]init];
        if ([[dic[@"data"] allKeys] containsObject:@"adv"]) {
            NSArray * arrayAdv = dic[@"data"][@"adv"];
            for (NSDictionary * dicAdv in arrayAdv) {
                LSZSignInformationMg * mg = [[LSZSignInformationMg alloc]init];
                mg.title = NullStringjudgment(NSStr(dicAdv[@"title"]));
                mg.price = NullStringjudgment(NSStr(dicAdv[@"price"]));
                mg.url = NullStringjudgment(NSStr(dicAdv[@"url"]));
                mg.banner = NullStringjudgment(NSStr(dicAdv[@"banner"]));
                [mutAdvArray addObject:mg];
            }
        }
        //早祷告
        if([NullStringjudgment(NSStr(dic[@"data"][@"sign_m"])) isEqualToString:@"1"]){
            mg.uptime_m = dic[@"data"][@"sign_m_result"][@"uptime"];
            mg.content_m = dic[@"data"][@"sign_m_result"][@"content"];
            mg.click_m = dic[@"data"][@"sign_m_result"][@"click"];
            mg.id_m = dic[@"data"][@"sign_m_result"][@"id"];
        }
        //晚祷告
        if([NullStringjudgment(NSStr(dic[@"data"][@"sign_n"])) isEqualToString:@"1"]){
            mg.uptime_n = dic[@"data"][@"sign_n_result"][@"uptime"];
            mg.content_n = dic[@"data"][@"sign_n_result"][@"content"];
            mg.click_n = dic[@"data"][@"sign_n_result"][@"click"];
            mg.id_n = dic[@"data"][@"sign_m_result"][@"id"];
        }
        mg.advArray = mutAdvArray;
        [AddArrayMg addObject:mg];
        self.arrayData = AddArrayMg;
    }
    return self;
}
@end

@implementation  LSZSignInformationMg
@end
